package InterfaceStaff;

import java.util.ArrayList;
import java.util.List;
import javax.swing.table.AbstractTableModel;

public class PresensiModel extends AbstractTableModel {
    private List<Mahasiswa> mhs = new ArrayList<Mahasiswa>();

    public PresensiModel (List<Mahasiswa> m)
    {
        this.mhs = m;
    }
    public int getRowCount() {
        return this.mhs.size();
    }

    public int getColumnCount() {
        return 2;
    }

    /*
     * method dibawah digunakan untuk mengambil isi dari kolom dan baris tertentu.
     */
    public Object getValueAt(int rowIndex, int columnIndex) {
        Mahasiswa k = mhs.get(rowIndex);
        switch (columnIndex)
        {
            case 0:return k.getNIM();
            case 1:return k.getNama();
            default:return "";
        }
    }
    @Override
    public String getColumnName(int columnIndex){
        switch (columnIndex){
            case 0: return "NIM";
            case 1: return "Nama";
            default: return "";
        }
    }
}
